#pragma once
#include "ProductionBasic.h"
#include <map>

#define ACTION_ERROR	(0)
#define ACTION_REDUCE	(1)
#define ACTION_SHIFT	(2)
#define ACTION_ACCEPT	(3)

typedef int ActionType;


typedef struct _structGOTO
{
	int StatusIndex;
}_GOTO;

typedef struct _structAction
{
	ActionType Action;
	union
	{
		int StatusIndex;
		int ProductionIndex;
	};
}_Action;

MAKE_PTR(CParserStatus);

class CParserStatus
{
public:
	static CParserStatusPtr create()
	{
		return CParserStatusPtr(new CParserStatus());
	}

public:
	CParserStatus();
	~CParserStatus();

public:
	int AddAction(Token_Type Token, _Action Action);
	int AddGoto(Token_Type Token, _GOTO Goto);

	_Action GetAction(Token_Type Token);
	_GOTO GetGoto(Token_Type Token);


	void Log();
protected:
	std::map<Token_Type ,_GOTO> m_Goto;
	std::map<Token_Type ,_Action> m_Action;
};